home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_095 / journal / journal.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  94 lines

  1. /*
  2.  *  JOURNAL.H  -  Common header file for JOURNAL.C and PLAYBACK.C
  3.  *
  4.  *             Copyright (c) 1987 by Davide P. Cervone
  5.  *  You may use this code provided this copyright notice is kept intact.
  6.  */
  7.  
  8. #include <libraries/dos.h>
  9. #include <exec/io.h>
  10. #include <exec/interrupts.h>
  11. #include <exec/memory.h>
  12. #include <devices/input.h>
  13. #include <devices/inputevent.h>
  14. #include <stdio.h>
  15.  
  16. #define ONE         1L
  17.  
  18. extern struct MsgPort *CreatePort();
  19. extern struct IOStdReq *CreateStdIO();
  20. extern LONG AllocSignal(), Wait(), SetSignal();
  21. extern struct Task *FindTask();
  22. extern struct InputEvent *AllocMem();
  23. extern FILE *fopen();
  24. extern long errno, _OSERR;              /* Lattice and DOS error numbers */
  25.  
  26. extern void RemoveHandler();            /* defined later on */
  27.  
  28. /*
  29.  *  assembly routine that gets called by the Input.Device which sets up
  30.  *  the stack and calls our input handler
  31.  */
  32. extern void myHandlerStub();
  33.  
  34.  
  35. /*
  36.  *  Structure used to pack event data into a small space.  This is the 
  37.  *  format used to record that data in the journal file */
  38.  
  39. struct SmallEvent
  40. {
  41.    union
  42.    {
  43.       struct
  44.       {
  45.          UBYTE se_IDType;   /* ie_Class and ie_Code combined */
  46.          UBYTE se_Raw;      /* RawKey Code */
  47.          UWORD se_PrevChar; /* previous key and qualifier */
  48.       } se_ID;
  49.       ULONG se_XYpos;       /* X in bits 0-11, Y in 12-23 (ie_Type in 24-31) */
  50.    } se_Long1;
  51.    UWORD se_Qualifier;
  52.    ULONG se_Long2;          /* Micros in 0-19, Ticks in 20-32 */
  53. };
  54. #define se_Type   se_Long1.se_ID.se_IDType
  55. #define se_Code   se_Long1.se_ID.se_Raw
  56. #define se_Prev   se_Long1.se_ID.se_PrevChar
  57. #define se_XY     se_Long1.se_XYpos
  58. #define se_Ticks  se_Long2
  59. #define se_Micros se_Long2
  60. #define se_Count  se_Long2
  61.  
  62. /*
  63.  *  Some shorthands for InputEvent fields
  64.  */
  65. #define my_Prev   ie_X
  66. #define my_Time   ie_Secs                   /* micros since last event */
  67. #define my_Ticks  ie_Mics                   /* ticks since last event */
  68. #define my_Ready  ie_NextEvent              /* TRUE when it can be posted */
  69. #define my_InUse  ie_Class                  /* TRUE when it is in use */
  70. #define my_Saved  ie_SubClass               /* TRUE if is has been recorded */
  71. #define my_Count  my_Time                   /* number of compressed events */
  72. #define ie_Secs   ie_TimeStamp.tv_secs
  73. #define ie_Mics   ie_TimeStamp.tv_micro
  74.  
  75. #define COUNTMASK 0x3F                      /* how much of my_Count is count */
  76. #define READY     ((struct InputEvent *) TRUE)
  77. #define TIME      (theEvent->ie_Mics-TimerMics)
  78. #define MILLION   1000000
  79.  
  80. #define XMINMOUSE      xminmove
  81. #define YMINMOUSE      yminmove
  82. #define XDEFMIN        8                    /* default DX */
  83. #define YDEFMIN        8                    /* default DY */
  84. #define LONGTIME       8                    /* if this many ticks occur, we */
  85.                                             /*   write out a dummy move to */
  86.                                             /*   record the pause */    
  87.  
  88. #define IE_SIZE        sizeof(struct InputEvent)
  89. #define NEWEVENT       AllocMem(IE_SIZE,0)
  90. #define FREEVENT(ev)   FreeMem(ev,IE_SIZE)
  91.  
  92. #define SIGBREAKF_ANY  (SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D |\
  93.                         SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F)
  94.